<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE topic
  PUBLIC "-//OASIS//DTD DITA Composite//EN" "ditabase.dtd">
<topic id="topic1">
    <title id="bv20941">ALTER FOREIGN DATA WRAPPER</title>
    <body>
        <p id="sql_command_desc">Changes the definition of a foreign-data wrapper.</p>
        <section id="section2">
            <title>Synopsis</title>
            <codeblock id="sql_command_synopsis">ALTER FOREIGN DATA WRAPPER <varname>name</varname>
    [ HANDLER <varname>handler_function</varname> | NO HANDLER ]
    [ VALIDATOR <varname>validator_function</varname> | NO VALIDATOR ]
    [ OPTIONS ( [ ADD | SET | DROP ] <varname>option</varname> ['<varname>value</varname>'] [, ... ] ) ]

ALTER FOREIGN DATA WRAPPER <varname>name</varname> OWNER TO <varname>new_owner</varname>
ALTER FOREIGN DATA WRAPPER <varname>name</varname> RENAME TO <varname>new_name</varname></codeblock>
        </section>
        <section id="section3">
            <title>Description</title>
            <p><codeph>ALTER FOREIGN DATA WRAPPER</codeph> changes the definition of a foreign-data wrapper.
                The first form of the command changes the support functions or generic options of 
                the foreign-data wrapper. Greenplum Database requires at least one clause. The second and third forms of the command change the owner or name of the foreign-data wrapper.</p>
            <p>Only superusers can alter foreign-data wrappers. Additionally, only superusers can own foreign-data wrappers</p>
        </section>
        <section id="section4">
            <title>Parameters</title>
            <parml>
                <plentry>
                    <pt><varname>name</varname></pt>
                    <pd>
                        <p>The name of an existing foreign-data wrapper.</p>
                    </pd>
                </plentry>
                <plentry>
                    <pt>HANDLER <varname>handler_function</varname></pt>
                    <pd>
                        <p>Specifies a new handler function for the foreign-data wrapper.</p>
                    </pd>
                </plentry>
                <plentry>
                    <pt>NO HANDLER</pt>
                    <pd>
                        <p>Specifies that the foreign-data wrapper should no longer have a handler function.</p> <note>You cannot access a foreign table that uses a foreign-data wrapper with no handler.</note>
                    </pd>
                </plentry>
                <plentry>
                    <pt>VALIDATOR <varname>validator_function</varname></pt>
                    <pd>
                        <p>Specifies a new validator function for the foreign-data wrapper.</p><p>Options to the foreign-data wrapper, servers, and user mappings may become invalid when you change the validator function. You must make sure that these options are correct before using the modified foreign-data wrapper. Note that Greenplum Database checks any options specified in this <codeph>ALTER FOREIGN DATA WRAPPER</codeph> command using the new validator.</p>
                    </pd>
                </plentry>
                <plentry>
                    <pt>NO VALIDATOR</pt>
                    <pd>
                        <p>Specifies that the foreign-data wrapper should no longer have a validator function.</p>
                    </pd>
                </plentry>
                <plentry>
                    <pt>OPTIONS ( [ ADD | SET | DROP ] <varname>option</varname> ['<varname>value</varname>'] [, ... ] )</pt>
                    <pd>
                        <p>Change the foreign-data wrapper's options. <codeph>ADD</codeph>, <codeph>SET</codeph>, and <codeph>DROP</codeph> specify the action to perform. If no operation is explicitly specified, the default operation is <codeph>ADD</codeph>. Option names must be unique. Greenplum Database validates names and values using the foreign-data wrapper's validator function, if any.</p>
                    </pd>
                </plentry>
                <plentry>
                    <pt>OWNER TO <varname>new_owner</varname></pt>
                    <pd>
                        <p>Specifies the new owner of the foreign-data wrapper. Only superusers can own foreign-data wrappers.</p>
                    </pd>
                </plentry>
                <plentry>
                    <pt>RENAME TO <varname>new_name</varname></pt>
                    <pd>
                        <p>Specifies the new name of the foreign-data wrapper.</p>
                    </pd>
                </plentry>
            </parml>
        </section>
        <section id="section6">
            <title>Examples</title>
            <p>Change the definition of a foreign-data wrapper named <codeph>dbi</codeph> by adding a new option named <codeph>foo</codeph>, and removing the option named <codeph>bar</codeph>:</p><codeblock>ALTER FOREIGN DATA WRAPPER dbi OPTIONS (ADD foo '1', DROP 'bar');</codeblock>
            <p>Change the validator function for a foreign-data wrapper named <codeph>dbi</codeph> to <codeph>bob.myvalidator</codeph>:</p><codeblock>ALTER FOREIGN DATA WRAPPER dbi VALIDATOR bob.myvalidator;</codeblock>
        </section>
        <section id="section7">
            <title>Compatibility</title>
            <p><codeph>ALTER FOREIGN DATA WRAPPER</codeph> conforms to ISO/IEC 9075-9 (SQL/MED), with the exception that the <codeph>HANDLER</codeph>, <codeph>VALIDATOR</codeph>, <codeph>OWNER TO</codeph>, and <codeph>RENAME TO</codeph> clauses are Greenplum Database extensions.</p>
        </section>
        <section id="section8">
            <title>See Also</title>
            <p><codeph><xref href="CREATE_FOREIGN_DATA_WRAPPER.xml#topic1">CREATE FOREIGN DATA WRAPPER</xref></codeph>,
                        <codeph><xref href="DROP_FOREIGN_DATA_WRAPPER.xml#topic1">DROP
                    FOREIGN DATA WRAPPER</xref></codeph></p>
        </section>
    </body>
</topic>
